//
//  ShopDetailViewController.m
//  DanTang
//
//  Created by honeyrr on 2017/9/13.
//  Copyright © 2017年 honeyrr. All rights reserved.
//

#import "ShopDetailViewController.h"

@interface ShopDetailViewController ()<UIWebViewDelegate>
{
    UIWebView *web;
    UIActivityIndicatorView *av;
}

@end

@implementation ShopDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"攻略详情";
    web = [[UIWebView alloc]initWithFrame:self.view.bounds];
    web.delegate = self;
    [self.view addSubview:web];
    
    NSURL *url = [NSURL URLWithString:self.urlString];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [web loadRequest:request];
    
    av = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    [av sizeToFit];
    av.center = CGPointMake(self.view.frame.size.width/2.0, self.view.frame.size.height/2.0);
    [self.view addSubview:av];
}

- (void)webViewDidStartLoad:(UIWebView *)webView
{
    [av startAnimating];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    [av stopAnimating];
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    [av stopAnimating];
    // 失败的提示
}

@end
